<?php

include ('../session.php');
include ('../db.php');
include ('config.php');

$output = '';

$output .= "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
  <head>
    <title>Panic Points - View Location</title>
    <link href=\"../general.css\" rel=\"stylesheet\" type=\"text/css\">
  </head>
  <body>";

include ('navigation.php');

$c_locationid = intval ($locationid);

$query = "select raid_id, raid_date, location_name, event_name
          from " . DKP_RAIDS . " as raids
          inner join " . DKP_LOCATIONS . " as locations
          on locations.location_id = raids.location_id
          inner join " . DKP_EVENTS . " as events
          on events.event_id = raids.event_id
          where raids.location_id = $c_locationid";
$result = mysql_query ($query);

$output .= "
    <span class=\"listtitle\">raids</span>
    <table class=\"list\" cellspacing=\"0\" cellpadding=\"0\">
      <tr class=\"listheader\">
        <td>date</td>
        <td>raid</td>
      </tr>";

if (mysql_num_rows ($result) > 0)
{
  $i = 0;
  while ($row = mysql_fetch_array ($result))
  {
    $i++;

    $output .= "
      <tr class=\"" . ($i & 1 ? "listodd" : "listeven") . "\">
        <td>" . $row['raid_date'] . "</td>
        <td><a href=\"viewraid.php?raidid=" . $row['raid_id'] . "\">" . $row['location_name'] . " - " . $row['event_name'] . "</a></td>
      </tr>";
  }
}
else
{
  $output .= "
      <tr class=\"listempty\">
        <td colspan=\"2\">no raids</td>
      </tr>";
}

$output .= "
    </table>";

$output .= "
  </body>
</html>";

echo $output;

?>
